import Main from '../views/Main.vue';
import commonRouters from '@/common/router';

// 不作为Main组件的子页面展示的页面单独写，如下
export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'Login - 登录'
    },
    component: resolve => { require(['../views/login.vue'], resolve); }
};
// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    component: Main,
    children: [
        { path: 'home', title: '首页', name: 'home_index', component: resolve => { require(['../views/home/home.vue'], resolve); } },
        {
            path: 'post_service_project',
            icon: 'ios-paper-outline',
            name: 'post_service_project',
            title: '发布服务信息',
            component: resolve => { require(['../views/service_manage/post_project.vue'], resolve); }
        },
        {
            path: 'post_demand_project',
            icon: 'ios-paper-outline',
            name: 'post_demand_project',
            title: '发布需求信息',
            component: resolve => { require(['../views/demand_manage/post_project.vue'], resolve); }
        },
    ]
};

// 作为Main组件的子页面展示并且在左侧菜单显示的路由写在appRouter里
export const appRouter = [
    {
        path: '/info_preview',
        name: 'info_preview',
        icon: 'ios-folder',
        title: '信息总览',
        component: Main,
        children: [
            { path: 'home', title: '首页', name: 'home', component: resolve => { require(['../views/home/home.vue'], resolve); } }
        ]
    },
    {

        path: '/service_manage',
        icon: 'ios-folder',
        name: 'service_manage',
        title: '机构服务',
        role_type: [5],
        component: Main,
        children: [
            {
                path: 'posted_projects',
                icon: 'ios-paper-outline',
                name: 'posted_service_projects',
                title: '发布服务',
                component: resolve => { require(['../views/service_manage/posted_projects.vue'], resolve); }
            },
            // {
            //     path: 'posted_projects',
            //     icon: 'ios-paper-outline',
            //     name: 'service_initiate_request',
            //     title: '发起服务请求',
            //     component: resolve => { require(['../views/demand_manage/posted_project.vue'], resolve); }
            // },
            {
                path: 'interview_initiated',
                icon: 'ios-paper-outline',
                name: 'interview_initiated',
                title: '已发起的请求',
                component: resolve => { require(['../views/service_manage/interview_initiated.vue'], resolve); }
            },
            {
                path: 'delivery_received',
                icon: 'ios-paper-outline',
                name: 'delivery_received',
                title: '已收到的请求',
                component: resolve => { require(['../views/service_manage/delivery_received.vue'], resolve); }
            },
            {
                path: 'abutment',
                icon: 'ios-paper-outline',
                name: 'service_abutment',
                title: '处理中的服务',
                component: resolve => { require(['../views/service_manage/abutment.vue'], resolve); }
            },
            {
                path: 'recommond',
                icon: 'ios-paper-outline',
                name: 'recommond_service',
                title: '推荐的需求',
                component: resolve => { require(['../views/service_manage/recommond.vue'], resolve); }
            },
        ]
    },
    {
        path:'/demand_manage',
        icon:'ios-folder',
        name:'demand_manage',
        role_type: [3,4],
        title:'机构服务',
        component:Main,
        children:[
            {
                path: 'posted_projects',
                icon: 'ios-paper-outline',
                name: 'posted_demand_projects',
                title: '发布需求',
                component: resolve => { require(['../views/demand_manage/posted_project.vue'], resolve); }
            },
            // {
            //     path: 'demand_find_service',
            //     icon: 'ios-paper-outline',
            //     name: 'demand_find_service',
            //     title: '申请服务',
            //     href: "/#/index/find_service"
            // },
            {
                path: 'demand_initiated',
                icon: 'ios-paper-outline',
                name: 'demand_initiated',
                title: '已申请的服务',
                component: resolve => { require(['../views/demand_manage/interview_initiated.vue'], resolve); }
            },
            {
                path: 'demand_received',
                icon: 'ios-paper-outline',
                name: 'demand_received',
                title: '已收到的服务请求',
                component: resolve => { require(['../views/demand_manage/delivery_received.vue'], resolve); }
            },
            {
                path: 'abutment',
                icon: 'ios-paper-outline',
                name: 'demand_abutment',
                title: '处理中的服务',
                component: resolve => { require(['../views/demand_manage/abutment.vue'], resolve); }
            },
            {
                path: 'recommond',
                icon: 'ios-paper-outline',
                name: 'recommond_demand',
                title: '推荐的服务',
                component: resolve => { require(['../views/demand_manage/recommond.vue'], resolve); }
            },
        ]
    },
    {
        path: '/plateformservice',
        icon: 'ios-folder',
        name: 'plateformservice',
        role_type: [3,4],
        title: '平台服务',
        component: Main,
        children:[
            {
                path: 'all_plateformservice',
                icon: 'ios-paper-outline',
                name: 'all_plateformservice',
                title: '平台发布的服务',
                component: resolve => { require(['../views/plateformservice/all_plateformservice.vue'], resolve); }
            },
            {
                path: 'applied_plateformservice',
                icon: 'ios-paper-outline',
                name: 'applied_plateformservice',
                title: '已申领的服务',
                component: resolve => { require(['../views/plateformservice/applied_plateformservice.vue'], resolve); }
            },
            {
                path: 'listed_company_info',
                icon: 'ios-paper-outline',
                name: 'listed_company_info',
                title: '完善上市信息',
                component: resolve => { require(['../views/plateformservice/listed_company_info.vue'], resolve); }
            }
        ]
        
    },
    {
        path: '/service_account_manage',
        icon: 'ios-folder',
        name: 'service_account_manage',
        title: '账户管理',
        component: Main,
        children: [
            {
                path: 'me',
                icon: 'ios-paper-outline',
                name: 'account_safe',
                title: '账户安全',
                component: resolve => { require(['../views/account_manage/account_safe.vue'], resolve); }
            },
        ]
    },
    {
        path: '/message',
        icon: 'ios-folder',
        name: 'message',
        title: '消息中心',
        component: Main,
        children: [
            { path: 'message', title: '消息中心', name: 'message_index', component: resolve => { require(['../views/message/message.vue'], resolve); } }
        ]
    },
    
];

// 所有上面定义的路由都要写在下面的routers里
export const routers = [
    loginRouter,
    otherRouter,
    ...appRouter,
    ...commonRouters
];
